package main

import "fmt"

func Downloader(musicURL string) {
	// 分析平台
	platform := ParseMusic(musicURL)
	// 传入对应平台解析
	fmt.Println("正在分析音乐")
	//choosePlatform(platform,musicURL)
	music := choosePlatform(platform, musicURL)
	music.download()
}

// 选择平台分发
func choosePlatform(platform Platform, musicURL string) (music *Music) {

	switch platform {
	case PlatformNetEasy:
		fmt.Println("当前平台【网易云音乐】")
		music = parseByNetEasy(musicURL)
	case PlatformKuWo:
		fmt.Println("当前平台【酷我音乐】")
		music = parseByKw(musicURL)
	case PlatformKuGou:
		fmt.Println("当前平台【酷狗音乐】")
		music = ParseByKuGouNew(musicURL)
	}
	return music
}
